
using System;
using System.Collections;
using System.Data;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
using System.Windows.Forms;
 // ERROR: Not supported in C#: OptionDeclaration
namespace NCS_CS
{
	internal partial class frmTiaoling : System.Windows.Forms.Form
	{
		private int[] c = new int[ModMain.NUMChanel  ];
        private int[] getc = new int[ModMain.NUMChanel];

		private void Combo1_TextChanged(System.Object eventSender, System.EventArgs eventArgs)
		{
			//
		}



		private void Combo1_SelectedIndexChanged(System.Object eventSender, System.EventArgs eventArgs)
		{
            showCurve((int)c[Combo1.SelectedIndex ], (int)getc[Combo1.SelectedIndex ]);
			//
		}
		public void showCurve(int c,int get)
		{
			double y =0;
			if (!ModMain.getFrmMain().csy1.islinked) {
				modLog.savelogmsg("未联机");
				modLog.showLog();
				return;
			}
			double x = 0;
			double[] xArr = null;
			double[] yArr = null;
			int n = 20;
			xArr = new double[n ];
			yArr = new double[n];
			for (int i=0;i<n;i++)//(x = -10; x <= 10; x += 20 / n) {
            {
                x = -10+i *20 / n;
				Label1.Text = Convert.ToString(x);
				Label1.Refresh();
				y = ModMain.getFrmMain().csy1.changeJixian( Convert.ToInt32(c),  x,get);
				xArr[i] = x;
				yArr[i] = y;
			}
			y = ModMain.getFrmMain().csy1.changeJixian(Convert.ToInt32(c),  0,get);
			this.mcurve1.setLineCount(1);
			this.mcurve1.setArrV(ref xArr, ref yArr, n, 0);
			this.mcurve1.fit();
		}
		private void frmTiaoling_Load(System.Object eventSender, System.EventArgs eventArgs)
		{

			c[0] = ModMain.getEleChanel("C");
			c[1] = ModMain.getEleChanel("S");
			c[2] = ModMain.getEleChanel("C2");
			c[3] = ModMain.getEleChanel("S2");
            getc[0] = ModMain.getEleChanel("C");
            getc[1] = ModMain.NzeroChannel;
            getc[2] = ModMain.getEleChanel("C2");
            getc[3] = ModMain.NzeroChannel ;

			//
			this.mcurve1.setxyDw("", "v");
		}

	}
}
